package com.queen.restaurant.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;
@Entity
@javax.persistence.Table(name="t_restaurant")
public class Restaurant implements Serializable{
	//主键uuid
	@Id
	@Column(name="id",nullable=false,length=32)
	@GenericGenerator(name="hibernate-uuid",strategy="uuid")
	@GeneratedValue(generator="hibernate-uuid")
	private String id;
	@Column(nullable=false)
	private String restaurantName;
	@Column
	@JsonIgnore
	private String password;
	@Column
	private String address;
	@Column
	private String phone;
	@Column
	private String introduce;
	@Column
	private String type;
	//百度LBS存储ID
	@Column
	private String restaurantPoiId;
	//纬度latitude
	@Column
	private String latitude;
	//经度longitude
	@Column
	private String longitude;
		
	@Column
	private String restaurantImgUrl;
	
	@OneToMany(mappedBy="restaurant",fetch=FetchType.LAZY,cascade={CascadeType.PERSIST,CascadeType.MERGE})
//	@JoinColumn(name="restaurantId")
	private List<Table> tables = new ArrayList<Table>();
	
	@OneToMany(mappedBy="restaurant",fetch=FetchType.LAZY,cascade={CascadeType.PERSIST,CascadeType.MERGE})
//	@JoinColumn(name="restaurantId")
	private List<CourseType> courseTypes = new ArrayList<CourseType>();
	
	public Restaurant() {
	}

	public Restaurant(String restaurantName, String password, String address,
			String phone, String introduce, String type) {
		this.restaurantName = restaurantName;
		this.password = password;
		this.address = address;
		this.phone = phone;
		this.introduce = introduce;
		this.type = type;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getRestaurantName() {
		return restaurantName;
	}

	public void setRestaurantName(String restaurantName) {
		this.restaurantName = restaurantName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getIntroduce() {
		return introduce;
	}

	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@JsonIgnore
	public List<Table> getTables() {
		return tables;
	}

	public void setTables(List<Table> tables) {
		this.tables = tables;
	}
	
	@JsonIgnore
	public List<CourseType> getCourseTypes() {
		return courseTypes;
	}

	public void setCourseTypes(List<CourseType> courseTypes) {
		this.courseTypes = courseTypes;
	}
	public String getRestaurantPoiId() {
		return restaurantPoiId;
	}

	public void setRestaurantPoiId(String restaurantPoiId) {
		this.restaurantPoiId = restaurantPoiId;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getRestaurantImgUrl() {
		return restaurantImgUrl;
	}

	public void setRestaurantImgUrl(String restaurantImgUrl) {
		this.restaurantImgUrl = restaurantImgUrl;
	}

}